#pragma once
#ifndef __LIT__SCRIPT__BINARY__STREAM__HH__
#define __LIT__SCRIPT__BINARY__STREAM__HH__

#include <LitStream.h>
#include <iostream>
#include <angelscript.h>

namespace Lit
{
	class ScriptStream : public asIBinaryStream, public Stream
	{
	public:
		ScriptStream(const std::string &fname="", Lit::Stream::Access access = Lit::Stream::BinaryRead );
		ScriptStream( const ScriptStream& rk );
		~ScriptStream();

		static std::string getCOpenMode( Access access );
		size_t size() const;
		bool open( const std::string &name, Access access = BinaryRead );
		void close();
		ScriptStream& read( size_t num_chars, std::string & out ) ;
		ScriptStream& write( const std::string& str );
		ScriptStream& readUntil( char c, std::string& out = std::string() );
		bool eof() const;
		bool valid() const;

		void Write(const void *ptr, asUINT size) ;
		void Read(void *ptr, asUINT size) ;

	protected:
		FILE * mStream;
		size_t mSize;
	};
};

#endif